package com.muyu.product.domain.model;

import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.product.domain.req.RuleInfoSaveReq;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.util.List;

/**
 * @author DongZl
 * @description: 规格保存模型
 * @Date 2024-3-4 下午 02:33
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class RuleInfoAddModel extends BaseEntity {

    /** 规格名称 */
    private String name;

    /** 规格状态 */
    private String status;

    /**
     * 规格属性集合
     */
    private List<RuleAttrAddModel> ruleAttrList;

    public static RuleInfoAddModel saveReqBuild(RuleInfoSaveReq req){
        return RuleInfoAddModel.builder()
                .name(req.getName())
                .status(req.getStatus())
                .ruleAttrList(req.getRuleAttrList())
                .build();
    }
}
